Macros allow you to record a sequence of keypresses so that you can execute them again when you want
to.
Macros are saved to special registers.
You define before starting to record them.
Let me demonstrate by pressing Q in normal mode followed by a character with defined that character
to be a reference for that specific sequence of keypresses.
So when pressed Q Then a
as you see it says regarding a let's perform some actions.
Press 0 2 go to the start of the line to go in insert mode press space twice escape to get to normal
mode then to go down then zero again to get to the start of the line.
We're done Priscu again to stop recording.
Now we can call the macro and execute the sequence back by hitting the symbol followed by the register
referenced by their character a we've defined earlier at a
we can execute the last macro invoked by typing it twice.
Of course we can repeat it as many times as we want.
By typing in a number in normal mode then pressing at twice let's say 20 times we can use my aquarists
to combine them with a powerful expression register.
We can use them together to generate content.
Dan I am actually we want to add one to each of the numbers in the document.
Let's start regarding our macro on character Q By pressing Q.
Q With the late one with X then entering in search mode with I
accessed the expression register with CON-TROLL are then type án equals 1 plus
press Kontrol are again then double quotes savey to D and then the register
press Enter
escape to get back to normal mode.
Then J to go down and Q and the macro recording.
Now type q to repeat the macro again.
7 at at.
To repeat the same macro for all the remaining numbers with color registers thoroughly in a couple of
days after I'll introduce panes and tabs.
You can append other commands to a macro by recording gave with the capital variant of the register
you have assigned the macro to what's recorded in your micro on register.
Q press Q-Q breasts 0.
I get in insert mode then typing in chapter then escape
0.
Q When the macro if we execute the macro back we see that we've forgotten to go to the next line press
Q A couple of times.
You to undo as always.
Let's append another command to the previous sequence.
PRISCU.
Capital Q.
Then press J to go down.
Then escape.
Q To stop recording.
Now let's start the macro again with at q.
At.
Repeat repeated again.
Fixed when we all start talking about auto completion multiple tabs and pains code folding and VM plugins.
You're going to notice how little difference there is between VM and full fledged the VM is faster and
also makes you faster too.
And the next video will talk about tabs and pains.